﻿using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace StaticFilesSample.Infrastructure
{
    public class BlogsViewComponent
        : ViewComponent
    {
        private readonly IBlogService _blogService;
        public BlogsViewComponent(IBlogService blogService)
        {
            _blogService = blogService;
        }
        public async Task<IViewComponentResult> InvokeAsync()
        {
            var blog = await _blogService.GetBlogByIdAsync(1);
            return View(await Task.FromResult(blog));
        }
    }
}
